<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 团购信息主表
 * @ author: zuorenci
 * @ email: 904725327@qq.com
 * @ date: 2017/10/24 21:01
 */
class Tuan extends Model
{
    protected $table = 'tuan';

    public $timestamps = false;

    protected $fillable = [
        'tuan_id', //tuan_id 主键id
        'cate_id', //分类行业
        'type', //券类型1为团购套餐 2为代金券
        'shop_id', //适用门店 关联shop表
    ];
    /**
     * 关联店铺表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function shop()
    {
        return $this->hasOne('App\\Models\\Shop', 'shop_id', 'shop_id');
    }

    /**
     * 关联团购从表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function tuan_info()
    {
        return $this->hasOne('App\\Models\\TuanInfo', 'tuan_id', 'tuan_id');
    }

    /**
     * 关联团购从表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function tuan_img()
    {
        return $this->hasMany('App\\Models\\TuanImg', 'tuan_id', 'tuan_id');
    }
    /**
     * 关联团购从表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function industry()
    {
        return $this->hasOne('App\\Models\\Industry', 'industryID', 'cate_id');
    }
    /**
     * 关联团购从表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function combo()
    {
        return $this->hasMany('App\\Models\\Combo', 'tuan_id', 'tuan_id');
    }
    /**
     * 关联团购从表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function noticeAttr()
    {
        return $this->hasMany('App\\Models\\NoticeAttr', 'tuan_id', 'tuan_id');
    }
    /**
     * 关联团购从表
     * @ author: zuorenci
     * @ email: 904725327@qq.com
     * @ date: 2017/10/24 21:01
     */
    public function notice()
    {
        return $this->hasOne('App\\Models\\Notice', 'cate_id', 'cate_id');
    }

}
